import { GSelect } from 'geminis-react';
import { forwardRef, useCallback } from 'react';

export const RouteSelect = forwardRef((props: any, ref: any) => {

  const setName = useCallback((routes: any[]) => {
    routes.forEach((route: any) => {
      route.name = route.pointStart + ' - ' + route.pointEnd;
    });
  }, []);

  return (
    <GSelect
      url="/api/warehouse/basic/route?deleted=false"
      onDataLoaded={setName}
      onChange={props?.onChange}
      value={props?.value}
    />
  );
});
